import React from 'react'
import store from '../../redux/store'
import {increAction, decreAction, asyncIncreAction} from '../../redux/reducers/countReducer';

export default function Control() {
  //声明函数新增
  const incre = () => {
    store.dispatch(increAction(1));
  }

  const decre = () => {
    store.dispatch(decreAction(1));
  }

  const asyncIncre = () => {
    store.dispatch(asyncIncreAction(10));
  }

  return (
    <>
      <button className='btn btn-primary' onClick={incre}>增加</button>&nbsp;
      <button className='btn btn-danger' onClick={decre}>减少</button>&nbsp;
      <button className='btn btn-info' onClick={asyncIncre}>1 秒后增加 10 </button>
    </>
  )
}
